package com.stoneframe.base.util;

public class Pagination {
	/**
	 * 每页行数
	 * */
	private int rows=10;
	
	/**
	 * 当前页
	 * */
	private int page;
	
	/**
	 * 起始索引
	 * */
	private int indexofPage=0;
	
	/**
	 * 排序列
	 * */
	private String sidx;
	
	/**
	 * 排序类型
	 * */
	private String sord;
	
	/**
	 * 总记录数
	 * */
	private int records;
	
	/**
	 * 总页数
	 * */
	private int total;
	
	private PageData pd = new PageData();
	
	/**
	 * 是否总记录数
	 * */
	private Boolean isGetRecord=true;

	public int getRows() {
		return rows;
	}

	public void setRows(int rows) {
		this.rows = rows;
	}

	public int getPage() {
		return page;
	}

	public void setPage(int page) {
		this.page = page;
	}

	public int getIndexofPage() {
		if ((page-1) < 0){
			return 0;
        }else{
            return (page-1)*rows;
        }
	}

	public void setIndexofPage(int indexofPage) {
		this.indexofPage = indexofPage;
	}

	public String getSidx() {
		return sidx;
	}

	public void setSidx(String sidx) {
		this.sidx = sidx;
	}

	public String getSord() {
		return sord;
	}

	public void setSord(String sord) {
		this.sord = sord;
	}

	public int getRecords() {
		return records;
	}

	public void setRecords(int records) {
		this.records = records;
	}

	public int getTotal() {
		if (records > 0){
            return records % this.rows == 0 ? records / this.rows : records / this.rows + 1;
        }else{
            return 0;
        }
	}

	public void setTotal(int total) {
		this.total = total;
	}

	public PageData getPd() {
		return pd;
	}

	public void setPd(PageData pd) {
		this.pd = pd;
	}

	public Boolean getIsGetRecord() {
		return isGetRecord;
	}

	public void setIsGetRecord(Boolean isGetRecord) {
		this.isGetRecord = isGetRecord;
	}
	
	

}
